var keyId=getCookie('userId');
var local="http://47.104.10.151";



function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length
            return unescape(document.cookie.substring(c_start,c_end))
        }
    }
    return ""
}




function sendMsg() {
    var postal="987654321";
    var name=document.getElementById('name').value;
    var mobile=document.getElementById('mobile').value;
    var province=document.getElementById('s_province').value;
    var city=document.getElementById('s_city').value;
    var county=document.getElementById('s_county').value;
    var address=document.getElementById('address').value;
    var add="姓名:"+name+"电话:"+" "+mobile+" "+"具体地址："+province+city+county+address;

    xmlHttp=creatxmlHTTP();
    var txt="";//用于存储拼接字符串；
    var url=local+":8080/delivery/addDelivery";
    txt="user_id="+keyId+"&adress="+add+"&phone="+mobile+"&postal_code="+postal;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);


    window.open('index1.html');

}
function clean() {
    window.open('index1.html');
}

function creatxmlHTTP() {
    if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
        xmlHttp=new XMLHttpRequest();
    }else {
        // IE6, IE5 浏览器执行代码
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    return xmlHttp;
}

